package ihistoryApp.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum BattleRequestTypeEnum {
    Unknown(0, "未知"),
    Match(1, "匹配"),
    Next_Question(2, "下一题"),
    Answer(3, "作答")
    ;
    @JsonValue
    private final int value;
    private final String name;

    public static BattleRequestTypeEnum of(int value) {
        for (BattleRequestTypeEnum type: BattleRequestTypeEnum.values()) {
            if (type.value == value) {
                return type;
            }
        }
        return Unknown;
    }
}
